package com.lzl;


import org.springframework.beans.BeanUtils;

import java.math.BigDecimal;


public class Refactoring {
    public static void main(String[] args) {
        ProductInfo info = new ProductInfo();
        info.setProductId("101");
        info.setProductName("tv");
        info.setProductIcon("icon");
        info.setCategoryType(1);
        info.setProductStock(20);
        info.setProductPrice(new BigDecimal(9.36));
        info.setProductStatus(1);
        info.setProductDescription("xiaomi tv");
    }
    /*
    public static ProductVo setProductVo(ProductInfo info){
        ProductVo productVo = new ProductVo();
        productVo.setProductId(info.getProductId());
        productVo.setProductName(info.getProductName());
        productVo.setCategoryType(info.getCategoryType());
        productVo.setProductDescription(info.getProductDescription());
        productVo.setProductStatus(info.getProductStatus());
        productVo.setProductPrice(info.getProductPrice());
        productVo.setProductStock(info.getProductStock());
        return productVo;
    }
    */
    public static ProductVo setProductVo(ProductInfo info){
        ProductVo productVo = new ProductVo();
        BeanUtils.copyProperties(info,productVo);
        return productVo;
    }

}
